class filters {
    //收入明细类型过滤
    public static splitStateFillter(val: number) {
        switch (val) {
            case 1:
                return {
                    value: '待分账',
                    color: '#409EFF',
                };
            case 5:
                return {
                    value: '已分账',
                    color: '#67C23A',
                };
            case 10:
                return {
                    value: '分账失败',
                    color: '#F56C6C',
                };
        }
    }

    /**
     *  获取翼码账户开通状态
     */
    public static openStateFilter(type: number) {
        switch (type) {
            case 1:
                return {
                    value: '开户审核中',
                    type: 'warning',
                };
            case 2:
                return {
                    value: '开户成功',
                    type: 'success',
                };
            case 3:
                return {
                    value: '开户失败',
                    type: 'danger',
                };
        }
    }

    /**
     * 获取翼码账户使用状态
     */
    public static relationStateFilter(type: number) {
        switch (type) {
            case 0:
                return {
                    value: '禁用',
                    type: 'danger',
                };
            case 1:
                return {
                    value: '启用',
                    type: 'success',
                };
        }
    }

    /**
     * 订单状态过滤
     * @param {*} val
     */
    public static orderStateFillter = (val: number, val2: null | number) => {
        let type = '';
        switch (val) {
            case 1:
                type = '已接单待确认';
                break;
            case 5:
                type = '商户已确认';
                break;
            case 10:
                type = '服务员已确认';
                break;
            case 11:
                type = '已出发';
                break;
            case 12:
                if (val2 == 1) {
                    type = '计时中';
                } else if (val2 == 2) {
                    type = '结束待回收';
                } else if (val2 == 3) {
                    type = '超额结束';
                } else {
                    type = '已到达';
                }
                break;
            case 13:
                type = '已回收';
                break;
            case 15:
                type = '已取消';
                break;
            case 16:
                type = '取消失败';
                break;
            case 20:
                type = '已完成';
                break;
        }
        return type;
    };

    /** 秒数转小时 */
    public static timeCut = (seconds: any) => {
        if (seconds == false || seconds == '无') {
            return ''
        }
        var hours = seconds / 3600;
        return hours + '小时';
    }

    public static minTimeCut = (seconds: any) => {
        if (seconds == false || seconds == '无') {
            return ''
        }
        var min: any = (seconds / 60);
        if (min >= 60) {
            min = (min / 60) + '小时'
        } else {
            min = min + '分钟'
        }
        return min;
    }
}

export default filters;
